package XML;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;

/**
 * Created by IntelliJ IDEA.
 * User: admin
 * Date: 07.02.2006
 * Time: 15:23:48
 * To change this template use File | Settings | File Templates.
 *
 * @noinspection deprecation
 */
public class WmlDocument extends DefaultHandler {
    String formID;
    String currentTag;
    String title;


    public void startElement(String uri, String localName, String qName, Attributes attributes) {

        currentTag = qName;
        if (qName.equalsIgnoreCase("form")) {
              System.out.println(qName);
            formID = attributes.getValue("id");
            title =  attributes.getValue("title");
             System.out.println(formID);
        }


    }

    public void startDocument() {
        System.out.println("Start document");
    }


    public void endDocument() {
        System.out.println("End document");
    }

    public void startPrefixMapping(String prefix, String uri) {


    }

    public void characters(char[] ch, int start, int len) {
//        if (currentTag.equalsIgnoreCase("title"))
//            title = new String(ch, start, len);

    }

    public void error(SAXParseException e) {


    }

    public void ignorableWhitespace(char buf [], int offset, int length)
            throws SAXException {
        characters(buf, offset, length);
    }

    public String getCardID()
    {

        return formID;
    }
    public String getTitle()
    {

        return title;
    }

}
